﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WizzardTheGame
{
    class Inventory
    {
        private List<Item> items;

        private List<Key> keys;
        private List<Weapon> weapons;
        private List<Armor> armors;
        private List<Potion> potions;

        #region Properties

        public List<Item> Items
        {
            get { return items; }
            set { items = value; }
        }

        public List<Key> Keys {
            get { return keys; }
            private set { keys = value; }
        }

        public List<Weapon> Weapons {
            get { return weapons; }
            private set { weapons = value; }
        }

        public List<Armor> Armors {
            get { return armors; }
            private set { armors = value; }
        }

        public List<Potion> Potions {
            get { return potions; }
            private set { potions = value; }
        }

        #endregion

        public Inventory()
        {
            Items = new List<Item>();
            Keys = new List<Key>();
            Weapons = new List<Weapon>();
            Armors = new List<Armor>();
            Potions = new List<Potion>();
        }

        public void AddItem(Item item) {
            Items.Add(item);
            item.InInventory = true;

            String itemtype = item.GetType().ToString();
            Console.WriteLine(itemtype);
            if (itemtype.Contains("Weapon"))
            {
                Weapons.Add((Weapon)item);
            }
            else if (itemtype.Contains("Armor"))
            {
                Armors.Add((Armor)item);
            }
            else
            {
                throw new Exception("Error: Item added to inventory not supported yet");
            }
        }
    }
}
